<div ng-controller="cspinquiryEditController">
    <div class="bg-light lter b-b wrapper-sm">
        <h1 class="m-n font-thin h4">{{inquiryName}}</h1>
    </div>
    <div class="wrapper-sm">
        <div class="panel panel-default">
            <div class="panel-body">
                <form id="inquiryForm" class="form-validation form-horizontal" novalidate>
                    <button ng-show="false"></button>
                    <ng-form name="inquiryForms">
                        <div class="form-group">
                            <div class="panel-heading font-bold m-t-n m-b-sm">
                                基本信息
                            </div>
                            <label class="col-lg-1 pull-left control-label">子询价单编号:</label>
                            <label class="col-lg-2 control-label text-left" ng-if="editInquiryDis">{{cspInquiryChildCode}}</label>
                            <label class="col-lg-2 control-label text-left text-danger" ng-if="!editInquiryDis">点击发布后系统自动生成</label>
                            <label class="col-lg-1 pull-left control-label m-l-n">紧急程度<span class="text-danger">*</span></label>
                            <div class="col-lg-1">
                                <input id="inquiryAdd_urgency" name="responseTime" type="text" class="form-control input-sm" ng-model="responseTime" placeholder="请填写紧急程度" ng-disabled="editInquiryDis">
                            </div>
                            <div class="pull-left m-l-n-sm">
                                <select class="form-control input-sm" ng-model="responseTimeUnit" name="responseTimeUnit" ng-disabled="editInquiryDis" ng-options="x.value as x.text for x in urgencyUnitDropDown" required id="rgencyUnit">
                                <option value="">请选择</option>
                            </select>
                            </div>
                            <label class="pull-left control-label m-l-xs">内回复</label>
                            <div ng-if="editInquiryDis">
                                <label class="col-lg-1 pull-left control-label">询价时间  :</label>
                                <label class="col-lg-2 control-label text-left">{{cspInquiryTime}}</label>
                            </div>
                            <label ng-show="!editInquiryDis" class="col-lg-1 pull-left control-label">计划专员  :</label>
                            <label ng-show="!editInquiryDis" class="control-label text-left">{{plannerName}}</label>
                        </div>

                        <div class="form-group" ng-show="!editInquiryDis">
                            <label class="col-lg-1 pull-left control-label">商务专员<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select class="form-control input-sm" id="inquiryAdd_businessOfficerId" ng-disabled="editInquiryDis" ng-model="businessOfficerId" name="businessOfficerId" ng-options="x.id as x.realName for x in businessOfficerDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s m-l-sm pull-left control-label">客服专员<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select class="form-control input-sm" id="inquiryAdd_customerServiceOfficerId" ng-disabled="editInquiryDis" ng-model="customerServiceOfficerId" name="customerServiceOfficerId" ng-options="x.id as x.realName for x in serviceOfficerIdDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s m-l-sm pull-left control-label">调度专员<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select class="form-control input-sm" id="inquiryAdd_dispatchOfficerId" ng-disabled="editInquiryDis" ng-model="dispatchOfficerId" name="dispatchOfficerId" ng-options="x.id as x.realName for x in dispatchOfficerDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">客户单位<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div angucomplete-alt id="client" placeholder="" pause="100" selected-object="clientSelect" remote-api-handler="searchClient" search-fields="name" title-field="name" minlength="1" input-class="form-control form-control-small input-sm" initial-value="clientName"
                                    name="clientName" match-class="highlight" disable-input="editInquiryDis" required>
                                </div>
                            </div>
                            <label class="w-s pull-left control-label">发货计划人<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div angucomplete-alt id="consignor" placeholder="" pause="100" selected-object="consignorSelect" remote-api-handler="searchConsignor" search-fields="realName" title-field="realName" minlength="1" input-class="form-control form-control-small input-sm"
                                    initial-value="customerName" name="customerName" match-class="highlight" disable-input="editInquiryDis" required>
                                </div>
                            </div>
                            <label class="w-s pull-left control-label">发货人电话<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <input id="inquiryAdd_consignorPhone" name="customerPhone" type="text" class="form-control input-sm" ng-model="customerPhone" placeholder="请填写发货人电话" ng-pattern="/^1\d{10}$/" disabled="disabled" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">总询价内容:</label>
                            <div class="col-lg-10 pull-left control-label">
                                <textarea class="form-control input-sm" ng-model="content" placeholder="请填写总询价内容" ng-disabled="editInquiryDis" name="content"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="panel-heading font-bold m-b-sm">
                                线路信息
                            </div>
                            <label class="col-lg-1 pull-left control-label">发货地址<span class="text-danger">*</span></label>
                            <div class="col-lg-10">
                                <tms-address class="pull-left" city-list="shipCityList" area-list="shipAreaList" province="originProvince" city="originCity" area="originCounty" required="true" ischecked="true">
                                </tms-address>
                                <div class="col-lg-4 m-l-n-sm">
                                    <input id="inquiryAdd_startAddress" name="originDetails" type="text" class="form-control input-sm" ng-disabled="editInquiryDis" ng-model="originDetails" placeholder="请填写详细地址" required>
                                </div>

                            </div>
                            <div class="line  pull-in"></div>
                            <label class="col-lg-1 pull-left control-label">送货地址<span class="text-danger">*</span></label>
                            <div class="col-lg-10">
                                <tms-address class="pull-left" city-list="deliverCityList" area-list="deliverAreaList" province="destinationProvince" city="destinationCity" area="destinationCounty" ischecked="true" required="true">
                                </tms-address>
                                <div class="col-lg-4 m-l-n-sm">
                                    <input id="inquiryAdd_destinationDetails" name="destinationDetails" type="text" ng-disabled="editInquiryDis" class="form-control input-sm" ng-model="destinationDetails" placeholder="请填写详细地址" required>
                                </div>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">预计发货时间<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div class="input-group input-group-sm date">
                                    <input id="dataTime" name="foreArrivalTime" datetimepicker plugintype="datetime" ng-disabled="editInquiryDis" ng-model="foreArrivalTime" placeholder="预计发货时间" class="form-control" type="text" required />
                                    <span id="opendataTime" class="input-group-addon curpoint">
                                        <span class="glyphicon glyphicon-calendar"></span>
                                    </span>
                                </div>
                            </div>
                            <label class="w-s pull-left control-label">预计到货时间<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div class="input-group input-group-sm date">
                                    <input id="dataTimeEnd" name="foreDeliveryTime" datetimepicker plugintype="datetime" ng-disabled="editInquiryDis" ng-model="foreDeliveryTime" placeholder="预计到货时间" class="form-control" type="text" required ui-validate=" '$value>foreArrivalTime' " ui-validate-watch=" 'foreArrivalTime' "
                                    />
                                    <span id="opendataTimeEnd" class="input-group-addon curpoint">
                                        <span class="glyphicon glyphicon-calendar"></span>
                                    </span>

                                </div>
                            </div>
                            <label class="w-s pull-left control-label">里程数  </label>
                            <div class="col-lg-2">
                                <input id="inquiryAdd_mileage" name="mileage" type="text" class="form-control input-sm" ng-disabled="editInquiryDis" mile-pattern="/^[+]?\d+\.?\d*$/" ng-model="mileage" placeholder="请填写里程数">
                            </div>
                            <label class="control-label">公里</label>
                        </div>
                        <div class="form-group">
                            <div class="panel-heading font-bold m-b-sm">
                                货物信息
                            </div>
                            <label class="col-lg-1 pull-left control-label">货物类别<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select id="inquiryAdd_goodsTypeName" class="form-control input-sm" ng-model="goodsTypeId" ng-disabled="editInquiryDis" name="goodsTypeId" ng-change="goodsTypeSelect()" ng-options="x.id as x.name for x in goodsTypeDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">货物名称<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <div angucomplete-alt id="goodsId" placeholder="" pause="100" selected-object="onGoodsNameSelected" remote-api-handler="onGoodsNameAutoComplate" search-fields="name" title-field="name" minlength="0" input-class="form-control form-control-small input-sm"
                                    initial-value="goodsName" match-class="highlight" field-required="true" input-name="goodsId" auto-match="true" focus-first="true">
                                </div>
                                <!-- <select class="form-control input-sm" id="inquiryAdd_goodsName" ng-model="goodsId" name="goodsId" ng-disabled="editInquiryDis" ng-options="x.id as x.name for x in goodsNameDropDown" required>
                                    <option value="">请选择</option>
                                </select> -->
                            </div>
                            <label class="w-s pull-left control-label">货物数量<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <input id="inquiryAdd_goodsQuantity" name="quantityOfGoods" type="text" ng-pattern="/^[0-9]+(\.[0-9]{1,4})?$/" ng-disabled="editInquiryDis" class="form-control input-sm" ng-model="quantityOfGoods" placeholder="请填写货物数量" required>
                            </div>
                            <div class="col-lg-2 m-l-n-sm">
                                <select class="form-control input-sm" id="inquiryAdd_goodsQuantityUnit" ng-model="goodsUnit" name="goodsUnit" ng-disabled="editInquiryDis" ng-options="x.value as x.text for x in goodsQuantityUnitDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="panel-heading font-bold m-b-sm">
                                所需车辆信息
                            </div>
                            <label class="col-lg-1 pull-left control-label">所需车辆<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select id="inquiryAdd_carType" class="form-control input-sm" ng-model="vehicleType" name="vehicleType" ng-disabled="editInquiryDis" ng-options="x.value as x.text for x in carTypeDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">所需车长<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select id="inquiryAdd_carLength" class="form-control input-sm" ng-model="carLength" name="carLength" ng-disabled="editInquiryDis" ng-options="x.value as x.text for x in carLengthDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">承运方式<span class="text-danger">*</span></label>
                            <div class="col-lg-2">
                                <select id="inquiryAdd_carrierCategory" class="form-control input-sm" ng-model="carriageWay" ng-disabled="editInquiryDis" name="carrierCategory" ng-options="x.value as x.text for x in carrierCategoryDropDown" required>
                                    <option value="">请选择</option>
                                </select>
                            </div>
                            <label class="w-s pull-left control-label">装车效果</label>
                            <div class="col-lg-2">
                                <input id="inquiryAdd_loadingEffect" name="loadingEffect" type="text" class="form-control input-sm" ng-disabled="editInquiryDis" ng-model="loadingEffect" placeholder="请填写装车效果">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="panel-heading font-bold m-b-sm">
                                附件信息
                            </div>
                            <div class="col-md-4 m-l-xs" ng-if="!editInquiryDis">
                                <label class="pull-left m-l m-r">附件上传</label>
                               
                                <div class="col-md-3 form-group">
                                    <input id="inquiryAdd_attachmentUploader" name="attachmentUploader" type="file" file-read uploader="attachmentUploader" multiple />
                                </div>
                            </div>
                            <div class="wrapper-sm">
                                <div class="line  pull-in"></div>
                                <div class="wrapper-sm bg-light dk b-b m-b-xs hidden">
                                    <span class="">上传文件数: <b class="badge bg-info">{{ attachmentUploader.queue.length }}</b></span>
                                </div>
                                <table class="table bg-white-only b-a">
                                    <thead>
                                        <tr>
                                            <th width="50%">名称</th>
                                            <th >大小</th>
                                            <th >进度</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-repeat="item in attachmentUploader.queue">
                                            <td>
                                                <strong>{{item.fileName|| item.fileName }}</strong>
                                            </td>
                                            <td  nowrap>{{ item.fileSize/1024/1024|number:2 }} MB</td>
                                            <td >
                                                <div class="progress" style="margin-bottom: 0;">
                                                    <div class="progress-bar" role="progressbar" ng-style="{ 'width': item.progress + '%' }"></div>
                                                </div>
                                            </td>
                                            <td class="text-center">
                                                <span ng-show="item.isSuccess"><i class="glyphicon glyphicon-ok"></i></span>
                                                <span ng-show="item.isCancel"><i class="glyphicon glyphicon-ban-circle"></i></span>
                                                <span ng-show="item.isError"><i class="glyphicon glyphicon-remove"></i></span>
                                            </td>
                                            <td nowrap>
                                                <button id="inquiryAdd_upload" class="btn btn-success btn-xs" ng-if="!editInquiryDis" ng-click="attachmentUploader.upload(item)" ng-disabled="item.isReady || item.isUploading || item.isSuccess">
                                                    <span class="glyphicon glyphicon-upload"></span> 上传
                                                </button>
                                                <button id="inquiryAdd_onDelete" class="btn btn-danger btn-xs" ng-if="!editInquiryDis" ng-click="attachmentUploader.onDelete(item)">
                                                    <span class="glyphicon glyphicon-trash"></span> 删除
                                                </button>
                                                <button type="button" class="btn btn-primary btn-xs" ng-click="attachmentUploader.onDownload(item)" id="download">
                                                    <span class="fa fa-cloud-download"></span> 下载
                                                </button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <button id="inquiryAdd_uploadAll" class="btn btn-sm btn-addon btn-success" ng-click="attachmentUploader.uploadAll()" ng-if="!editInquiryDis" ng-disabled="!attachmentUploader.getNotUploadedItems().length">
                                    <i class="fa fa-arrow-circle-o-up"></i> 全部上传
                                </button>
                            </div>




                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label">备注</label>
                            <div class="col-lg-10">
                                <textarea class="form-control" ng-disabled="editInquiryDis" ng-model="attachmentRemarks" placeholder="请填写备注" name="attachmentRemarks"></textarea>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-lg-1 pull-left control-label"></label>
                            <div class="col-lg-5">
                                <button id="inquiryAdd_release" class="pull-right-xs btn btn-sm btn-primary btn-addon" ng-if="!editInquiryDis" ng-disabled="saveDis" ng-click="cspinquirySaveEdit()"><i class="fa fa-check"></i>询价发布</button>
                                <button id="inquiryAdd_cancel" ui-sref="app.inquiry.external_inquiry({name:'inquiry'})" class="pull-right-xs btn btn-sm btn-info btn-addon "><i class="fa fa-reply"></i>返回</button>
                            </div>
                        </div>
                    </ng-form>
                </form>
            </div>
        </div>

    </div>
</div>